<?php
namespace App\Http\Controllers\Enterprise;

use App\Http\Controllers\AdapterWebController;
use App\Models\User\UserClient;
use App\Models\Article\Article;
use App\Models\Article\ArticleClassify;
use App\Modules\Article\ApiArticle;
use App\Modules\Article\ApiArticleClassify;
use Illuminate\Http\Request;
//use Illuminate\Pagination\LengthAwarePaginator;
//use Illuminate\Support\Collection;

//企业站文章
class EnterpriseArticleController extends AdapterWebController
{
    //文章分类列表    
    public function articleClass(Request $request){
        $postData = array_filter($request->all());
        $classlist = $this->appLayerExec(ApiArticleClassify::class, 'articleClass', $postData);
        return view('enterprise.article.articlelist',['classlist'=>$classlist['res']]);
    }
    //指定文章分类
    public function assignClass(Request $request){
        if($request->isMethod('get')){
            $assignclass = $this->appLayerExec(ApiArticleClassify::class, 'assignClass');
            return view('enterprise.article.articlelist',['assignclass'=>$assignclass['res']]);
        }
        $postData = array_filter($request->all());
        $assignclass = $this->appLayerExec(ApiArticleClassify::class, 'assignClass', $postData);

        return view('enterprise.article.articlelist',['assignclass'=>$assignclass['res']]);
    }
    //指定分类下的文章列表
    public function articleList(Request $request){
        if($request->isMethod('get')){
            $articlelist = $this->appLayerExec(ApiArticle::class, 'articleList');
            return view('enterprise.article.articlelist',['articlelist'=>$articlelist['res']]);
        }
        $postData = array_filter($request->all());
        $articlelist = $this->appLayerExec(ApiArticle::class, 'articleList', $postData);

        return view('enterprise.article.articlelist',['articleList'=>$articleList['res']]);
    }
    //指定分类下的文章详情
    public function assignInfo(Request $request){
        if($request->isMethod('get')){
            $assigninfo = $this->appLayerExec(ApiArticle::class, 'assignInfo');
            return view('enterprise.article.articlelist',['assigninfo'=>$assigninfo['res']]);
        }
        $postData = array_filter($request->all());
        $assigninfo = $this->appLayerExec(ApiArticle::class, 'assignInfo', $postData);

        return view('enterprise.article.articlelist',['assigninfo'=>$assigninfo['res']]);
    }
    //文章详情
    public function articleInfo(Request $request){
        if($request->isMethod('get')){
            $articleinfo = $this->appLayerExec(ApiArticle::class, 'articleInfo');
            return view('enterprise.article.articlelist',['articleinfo'=>$articleinfo['res']]);
        }
        $postData = array_filter($request->all());
        $articleinfo = $this->appLayerExec(ApiArticle::class, 'articleInfo', $postData);

        return view('enterprise.subpage',['articleinfo'=>$articleinfo['res']]);
    }

}